package awt;

import java.awt.*;

/**
 * @description: 布局管理器
 * @author: Tom
 * @create: 2019-07-22 17:35
 **/
public class TwoButtons {
    private Frame f;
    private  Button b1;
    private  Button b2;
    public void go(){
        f=new Frame("FlowLayout");
        f.setLayout(new FlowLayout());
        b1=new Button("Press me");
        b2= new Button("Dont Press me");
        f.add(b1);
        f.add(b2);
        // 紧凑排列 其作用相当于setSize() 即让窗口尽量小  小到刚刚能够包容住两个按钮
        f.pack();
        f.setVisible(true);
    }

    public static void main(String[] args) {
        TwoButtons twoButtons = new TwoButtons();
        twoButtons.go();
    }
}
